/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kallsonys.session;

import com.kallsonys.object.ElementQuery;
import com.kallsonys.object.Vcategory;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author allan
 */
@Stateless
public class VcategoryFacade extends AbstractFacade<Vcategory> {

    @PersistenceContext(unitName = "Kallsonys-WarPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public VcategoryFacade() {
        super(Vcategory.class);
    }

    public List<com.kallsonys.object.Vcategory> getAllCategory(int page) {

        List<com.kallsonys.object.Vcategory> p = null;
 

        //int total = 0;

        Query queryfindByProductidproduct = em.createNamedQuery("Vcategory.findAll");

        /*int[] rango = {page * 10, (page * 10 + 10)};

        lstC = (List<com.kallsonys.object.Vcategory>) this.findRange(rango, queryfindByProductidproduct);

        total = this.count();*/
        
        /*p.setTotalPages(total);
        p.setLstItems(lstC);*/
        
        p = (List<com.kallsonys.object.Vcategory>)queryfindByProductidproduct.getResultList();

        return p;
    }
}
